FROM php:8.3-fpm-alpine

RUN apk update \
    && apk upgrade \
    && apk add --no-cache \
        freetype-dev \
        libpng-dev \
        jpeg-dev \
        libjpeg-turbo-dev

RUN docker-php-ext-configure gd \
        --with-freetype=/usr/lib/ \
        --with-jpeg=/usr/lib/ \
    && docker-php-ext-install gd && docker-php-ext-enable gd

RUN apk update && \
    apk add --no-cache git zlib-dev icu-dev libxml2-dev autoconf $PHPIZE_DEPS

# install/enable extensions
RUN docker-php-ext-configure intl && \
    docker-php-ext-install intl soap bcmath

# Mcrypt
RUN apk update && \
    apk add bash build-base gcc wget git autoconf libmcrypt-dev libzip-dev zip \
    g++ make openssl-dev

RUN docker-php-ext-install pdo pdo_mysql && docker-php-ext-enable pdo_mysql

RUN apk update \
    && apk upgrade \
    && apk add --no-cache \
        libpq-dev

RUN docker-php-ext-install pdo pdo_pgsql && docker-php-ext-enable pdo_pgsql

RUN pecl install mcrypt && \
    docker-php-ext-enable mcrypt

# webp

RUN apk update && \
    apk upgrade -U && \
    apk add ca-certificates ffmpeg libwebp libwebp-tools && \
    rm -rf /var/cache/*

# zip

RUN docker-php-ext-install zip

RUN mv $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini

# composer

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY ./common/php/conf.d /usr/local/etc/php/conf.d
COPY ./development/php/conf.d /usr/local/etc/php/conf.d
COPY ./development/php-fpm/conf.d /usr/local/etc/php/conf.d

WORKDIR /app

